#include "Circle.hpp"
#include <cmath>

namespace rgui
{

Circle::Circle(const rgui::vec2f &position, const float radius) :
	mPosition(position),
	mRadius(radius)
{

}

const rgui::vec2f& Circle::getPosition()
{
	return mPosition;
}

float Circle::getRadius()
{
	return mRadius;
}

void Circle::setPosition(const rgui::vec2f &position)
{
	mPosition = position;
}

void Circle::setRadius(float radius)
{
	mRadius = radius;
}

bool Circle::contains(const rgui::vec2f &position)
{
	float diffX = position.x - mPosition.x;
	float diffY = position.y - mPosition.y;
	// Not so efficient (no need for sqrtf. Possible to instead save mRadius^2 and compare to it)
	float distance = sqrtf(diffX * diffX + diffY * diffY);
	return distance <= mRadius;
}

}